package bid

import (
	"encoding/json"
	"github.com/golang/protobuf/proto"
	"wx-api/adx-bid/models/bid/BidModel"
)

type Huayan struct{}

func (z Huayan) DecodeReq(body []byte, cty string) (*BidModel.BidRequest, interface{}, string, error) {
	var err error
	m := &BidModel.BidRequest{}
	hty := "json"
	if cty == "application/protobuf" {
		err = proto.Unmarshal(body, m)
		hty = "proto"
	} else {
		err = json.Unmarshal(body, m)
	}
	return m, m, hty, err
}

func (z Huayan) EncodeRes(req interface{}, res *BidModel.BidResponse, cty string) (interface{}, error) {
	return res, nil
}
